
import { getConversationRequest } from '@/api/im-conversation'

const iMUser = {
  namespaced: true,
  state: {
    info: null
  },

  getters: {},

  mutations: {
    SET_INFO: (state, info) => {
      state.info = info
    }
  },

  actions: {
    getConversationAction({ commit }, parameters) {
      return new Promise((resolve, reject) => {
        getConversationRequest(parameters)
          .then(response => {
            const info = response.result
            commit('SET_INFO', info)
            resolve(response)
          })
          .catch(error => {
            reject(error)
          })
      })
    }
  }
}

export default iMUser
